package com.example.demo.controller;

import com.example.demo.mapper.SetmealMapper;
import com.example.demo.po.Setmeal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/setmeal")
public class SetmealController {

    //属性依赖mapper
    @Autowired
    private SetmealMapper setmealMapper;

    public void setSetmealMapper(SetmealMapper setmealMapper) {
        this.setmealMapper = setmealMapper;
    }

    //当前类处理客户端请求返回的数据都是json格式，大家可以拿postman来测试，非常方便
    //    1. setmeal/listSetmeal
//  ○ 参数：无
//  ○ 返回值：List（泛型：Setmeal）
//            ○ 功能：查询所有套餐类型列表
    @RequestMapping("/listSetmeal")
    public List<Setmeal> listSetmeal(){
        return setmealMapper.selectAll();
    }
}
